//
// Created by LiuYou on 2021/5/8.
//

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cerrno>


int main(int argc, char** argv) {
    if (argc < 2) {
        std::fprintf(stderr, "Usage: %s <file>\n", basename(argv[0]));
        return -1;
    }

    FILE* fp = std::fopen(argv[1], "r");
    if (fp == nullptr) {
        std::fprintf(stderr, "fopen(): %s\n", std::strerror(errno));
        std::exit(1);
    }

    std::fseek(fp, 0L, SEEK_END);
    std::fprintf(stdout, "当前文件大小为: %ld 个字节\n", std::ftell(fp));


//    return 0;
    std::exit(0);
}